/**
 * 
 */
package com.wordpress.sharebyblog.world.domain;

import java.io.Serializable;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author Bharat Mehta
 *
 */
public class WorldServiceRequest implements Serializable {
	
	
	private Map<String,String> request = new HashMap<String, String>();
	private Integer pageSize;
	private Integer page;
	public  static final String COUNTRYCODE = "countryCode";
	public  static final String REGIONNAME  =  "regionName";
	

	
	
	/**
	 * @return the request
	 */
	public Map<String, String> getRequest() {
		return request;
	}

	/**
	 * @param request the request to set
	 */
	public void setRequest(Map<String, String> request) {
		this.request = request;
	}
	
	

	/**
	 * @return the pageSize
	 */
	public Integer getPageSize() {
		return pageSize;
	}

	/**
	 * @param pageSize the pageSize to set
	 */
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	/**
	 * @return the page
	 */
	public Integer getPage() {
		return page;
	}

	/**
	 * @param page the page to set
	 */
	public void setPage(Integer page) {
		this.page = page;
	}

	public WorldServiceRequest() {
		super();
		// TODO Auto-generated constructor stub
	}

	public WorldServiceRequest(Map<String,String[]> parameters) {

		for(String key : parameters.keySet()){
			if(COUNTRYCODE.equals(key) ||REGIONNAME.equals(key)){
				String [] object = parameters.get(key);
				if(object != null && object.length > 0){
					request.put(key, object[0]);
					
				}
			}
		}
	}
	
	
	public WorldServiceRequest(Map<String, String[]> request, Integer pageSize,Integer page) {
		this(request);
		this.pageSize = pageSize;
		this.page = page;
	}

	public boolean contains(String parameterName) {
		return request.containsKey(parameterName);
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("WorldServiceRequest [request=");
		builder.append(request);
		builder.append("]");
		return builder.toString();
	}
	
	
	
	
	
	
	

}
